package com.fulihui.weixinsdk.request.material;

import com.alibaba.fastjson.JSON;
import com.fulihui.weixinsdk.http.HttpMethodEnum;
import com.fulihui.weixinsdk.request.WeixinRequest;
import com.fulihui.weixinsdk.result.material.MaterialGetCountResult;
import com.google.gson.Gson;

import java.util.Map;
import java.util.Objects;
import java.util.TreeMap;

/** 获取素材总数
 * Created by hongwang on 2018/1/9.
 */
public class MaterialGetCountReuest extends WeixinRequest<MaterialGetCountResult>{
    private transient String  access_token;
    @Override
    public Map<String, String> urlParam() {
        Map<String,String> parm=new TreeMap<String,String>();
        if(!Objects.isNull(access_token)){
            parm.put("access_token",access_token);
        }
        return parm;
    }

    @Override
    protected void childParam() {
    }

    @Override
    public String service() {
        return "https://api.weixin.qq.com/cgi-bin/material/get_materialcount";
    }

    @Override
    public String urlEndStr() {
        return null;
    }

    @Override
    public MaterialGetCountResult parseResult(String respStr) {
        return new Gson().fromJson(respStr,MaterialGetCountResult.class);
    }
    @Override
    public HttpMethodEnum httpMethod() {
        return HttpMethodEnum.GET;
    }

    @Override
    public String requestData() {
        return JSON.toJSONString(this);
    }
}
